package com.cy.核心编程.stream.obj;

import java.io.*;

/**
 * IO流_对象流_对象序列化
 */
public class Test1 {
    public static void main(String[] args) throws Exception {
        //生成一个对象的序列化文件
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(new File("src/person.dat")));
        Person p = new Person(1, "陈大爷", 18);
        oos.writeObject(p);
        oos.flush();
        oos.close();
    }
}
